//
//  ByAccountHeadView.m
//  recordworktool_ios
//
//  Created by mc on 2017/12/9.
//  Copyright © 2017年 ZhangZhanbin. All rights reserved.
//

#import "ByAccountHeadView.h"

@implementation ByAccountHeadView

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self){
        
        UIView *view = [[UIView alloc] init];
        [self addSubview:view];
        [view mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(10);
            make.right.equalTo(self).offset(-10);
            make.top.equalTo(self).offset(30);
            make.bottom.equalTo(self).offset(-5);
        }];
        view.backgroundColor = BY_THEME_COLOR;
        view.layer.cornerRadius = 10;
        view.layer.masksToBounds = YES;
        
        CGFloat width = (SCREEN_WIDTH - 20) / 4;
        UILabel *leftLabel = [[UILabel alloc] init];
        [view addSubview:leftLabel];
        [leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(view).offset(0);
            make.top.equalTo(view).offset(0);
            make.bottom.equalTo(view).offset(0);
            make.width.mas_equalTo(@(width));
        }];
        
        if (BY_USER.isWorker.integerValue == 1) {
            leftLabel.text = @"工头";
        }else{
            leftLabel.text = @"工人";
        }
        leftLabel.font = FONT(16);
        leftLabel.textColor = [UIColor whiteColor];
        leftLabel.textAlignment = NSTextAlignmentCenter;
        
        UILabel *centerLabel = [[UILabel alloc] init];
        [view addSubview:centerLabel];
        [centerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(leftLabel.mas_right).offset(0);
            make.top.equalTo(view).offset(0);
            make.bottom.equalTo(view).offset(0);
            make.width.mas_equalTo(@(width));
        }];
        centerLabel.text = @"时间";
        centerLabel.font = FONT(16);
        centerLabel.textColor = [UIColor whiteColor];
        centerLabel.textAlignment = NSTextAlignmentCenter;
        
        UILabel *rightLabel = [[UILabel alloc] init];
        [view addSubview:rightLabel];
        [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(view).offset(0);
            make.top.equalTo(view).offset(0);
            make.bottom.equalTo(view).offset(0);
            make.width.mas_equalTo(@(width));
        }];
        rightLabel.text = @"审计";
        rightLabel.font = FONT(16);
        rightLabel.textColor = [UIColor whiteColor];
        rightLabel.textAlignment = NSTextAlignmentCenter;
        
        UILabel *priceLabel = [[UILabel alloc] init];
        [view addSubview:priceLabel];
        [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(rightLabel.mas_left).offset(0);
            make.top.equalTo(view).offset(0);
            make.bottom.equalTo(view).offset(0);
            make.width.mas_equalTo(@(width));
        }];
        priceLabel.text = @"工钱";
        priceLabel.font = FONT(16);
        priceLabel.textColor = [UIColor whiteColor];
        priceLabel.textAlignment = NSTextAlignmentCenter;
        
        
    }
    return self;
}

@end
